package service

import (
	"ksd-social-api/modules/advert/mapper"
	"ksd-social-api/modules/advert/model/vo"
	"ksd-social-api/utils"
)

type AdvertService struct{}

var advertMapper = mapper.AdvertMapper{}

/**
 * @desc 根据类型查询广告
 * @author feige
 * @date 2023-11-14
 * @version 1.0
 */
func (service *AdvertService) FindAdvertByType(ftype int64, systemId uint64) []*vo.AdvertVo {
	advertsList := advertMapper.FindAdvertByType(ftype, systemId)
	advertVos := []*vo.AdvertVo{}
	for _, advert := range advertsList {
		advertVo := vo.AdvertVo{}
		utils.CopyProperties(&advertVo, advert)
		advertVos = append(advertVos, &advertVo)
	}
	return advertVos
}
